package jhlee42.swing;

import java.awt.BorderLayout;
import java.awt.FlowLayout;

import javax.swing.ImageIcon;
import javax.swing.JButton;
import javax.swing.JDialog;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.JSeparator;
import javax.swing.SwingConstants;
import javax.swing.border.EmptyBorder;
import java.awt.event.ActionListener;
import java.awt.event.ActionEvent;

public class AboutSwingProject extends JDialog {

	private final JPanel contentPanel = new JPanel();

	/**
	 * Launch the application.
	 */
	public static void main(String[] args) {
		try {
			
//			AboutSwingProject dialog = new AboutSwingProject();
////			dialog.setDefaultCloseOperation(JDialog.DISPOSE_ON_CLOSE);
//			dialog.setVisible(true);
			
		} catch (Exception e) {
			e.printStackTrace();
		}
	}

	/**
	 * Create the dialog.
	 */
	public AboutSwingProject(JFrame parent) { // 12...
		super(parent,ModalityType.APPLICATION_MODAL); // 12
		// 모달 대화상자를 만들기 위해 Jdialog의 생성자 호출
		// JDK 6에서 지원하는 모달 대화상자 생성법 사용
		// 12
		
		
	
		
		
		setTitle("Swing Project에 관하여..");
		setBounds(100, 100, 450, 300);
//		setLocationRelativeTo(null); // 2 정중앙
		
		
		
		
		getContentPane().setLayout(new BorderLayout());
		contentPanel.setBorder(new EmptyBorder(5, 5, 5, 5));
		getContentPane().add(contentPanel, BorderLayout.CENTER);
		contentPanel.setLayout(new BorderLayout(0, 0));
		{
			JLabel lblNewLabel = new JLabel("<html>\r\n<pre>\r\n:: 스윙 프로젝트 Swing Project v1\r\n\r\n(c) Copyright 2014. ohzo. All right Resetved\r\npower by Eclips, WindowBuilder\r\n</pre>\r\n</html>\r\n\r\n\r\n");
			lblNewLabel.setHorizontalAlignment(SwingConstants.CENTER);
			contentPanel.add(lblNewLabel, BorderLayout.CENTER);
		}
		{
			JLabel lblNewLabel_1 = new JLabel("");
			lblNewLabel_1.setIcon(new ImageIcon(AboutSwingProject.class.getResource("/images/background/about.png")));
			contentPanel.add(lblNewLabel_1, BorderLayout.WEST);
		}
		{
			JSeparator separator = new JSeparator();
			contentPanel.add(separator, BorderLayout.SOUTH);
		}
		{
			JPanel buttonPane = new JPanel();
			buttonPane.setLayout(new FlowLayout(FlowLayout.RIGHT));
			getContentPane().add(buttonPane, BorderLayout.SOUTH);
			{
				JSeparator separator = new JSeparator();
				buttonPane.add(separator);
			}
			{
				JButton okButton = new JButton("   확인   ");
				okButton.addActionListener(new ActionListener() {
					public void actionPerformed(ActionEvent e) {
						//System.exit(0);
						dispose(); // 현재 컴포넌트만 시스템 제거 // 13.
						
						
					}
				});
				okButton.setActionCommand("OK");
				buttonPane.add(okButton);
				getRootPane().setDefaultButton(okButton);
			}
		}
		setDefaultCloseOperation(JDialog.DISPOSE_ON_CLOSE); // !!!!!!!!!!!!!!
		setLocationRelativeTo(null); // 2 정중앙
	}

}
